﻿@namespace MatBlazor
@typeparam TItem

<MatDataTableHeader>
    <CascadingValue Value="@MatDataTableRenderMode.Header">
        @Columns(default(TItem))
    </CascadingValue>
</MatDataTableHeader>


<CascadingValue Value="@MatDataTableRenderMode.Row">
    <MatDataTableContent>
        @if (Items != null)
        {
            foreach (var item in Items)
            {
                <MatDataTableRow>
                    @Columns(item)
                </MatDataTableRow>
            }
        }
    </MatDataTableContent>
</CascadingValue>

@code
{
    [Parameter]
    public IReadOnlyList<TItem> Items { get; set; }

    [Parameter]
    public RenderFragment<TItem> Columns { get; set; }
}